package com.samp.lucene.func.userdefined;

import org.apache.lucene.queries.function.ValueSource;
import org.apache.solr.search.FunctionQParser;
import org.apache.solr.search.SyntaxError;
import org.apache.solr.search.ValueSourceParser;

public class ConcatenateFunctionParser extends ValueSourceParser {

	@Override
	public ValueSource parse(FunctionQParser fp) throws SyntaxError {
		ValueSource value1 = fp.parseValueSource();
		System.out.println(value1);
		ValueSource value2 = fp.parseValueSource();
		System.out.println(value2);
		String delimiter = null;
		if( fp.hasMoreArguments() ){
			delimiter = fp.parseArg();
		}
		return new ConcatenateFunction(value1, value2, delimiter);
	}

}
